#pragma once
#include "ContainerAndImagePanels.h"
class ContainerPanel:
	public Panel
{
public:		//Loader * loader;
	
	void clearNullImages();
	static void clearNullImagesAll();	
	void Init();
	BOOLEAN firstRepaint;
	BOOLEAN isViewedOne;	
	LRESULT WndProc_(HWND , UINT , WPARAM , LPARAM );
	ContainerPanel(HINSTANCE, char *);
	void setStudy(QString);
	void clearStudy(bool isClearStructure);
	void deleteAllImagePanels();
	static void clearStudies(int, bool isClearStructure);
	static void setBlurFilter();
	static void setSharpFilter();
	static void setNoFilter();
	static void verifyEmptyClImPanel();
	ImagePanel * flushViewedOne();
	void rePlaceActivePanels(int);
	void setOnePanelInTree();	
	void swapStruct(ContainerPanel *);
	void swapStudies(ContainerPanel * );
	void swapSeries(ContainerPanel * );	
	void swapStructInStudy(ContainerPanel *);
	void goNextAllImages(int);
	void goPrevAllImages(int);
	void repaintImage(int, int);
	void repaintImage();
	static void resetActivePanels();
	//void moveImage(int, int);
	void moveImage(float, float);
	static void moveImageAll(float, float);
	static void reScaleAll(float, int, int);
	static void repaintImageAll(int, int);
	static void repaintActiveImageAll();
	static void repaintImageAll();
	//BOOLEAN addImagePanel(char *); 
	BOOLEAN haveAllChosen(); 
	virtual BOOLEAN addImagePanel(DICOMStruct *); 
	void tryAddDicomStruct();
	void ViewOne(Panel *);
	void reScale(float, int, int);
	void turnVert();
	void turnHor();
	void reflect();
	void rotateRight();
	void rotateLeft();	
	static void flushOneAllActiveTopPanels();
	static void setViewOnlyChosenDicomStructs();
	static void setViewOnlyUnChosenDicomStructs();
	static void setViewAllDicomStructs();
	static void goNextImage();
	static void goPrevImage();
	static void goNextImage10();
	static void goPrevImage10();
	static void goFirstImage();
	static void goLastImage();
	static void goNextSeries();
	static void goPrevSeries();
	static void goNextStudy();
	static void goPrevStudy();
	static void ContainerPanel::autoFillPanelsByStudies(BOOLEAN);
	static void turnVertAll();
	static void turnRotateReflectToZeroAll();
	static void turnHorAll();
	static void reflectAll();
	static void rotateRightAll();
	static void rotateLeftAll();	
	static int rebuildTopPanels(int, BOOLEAN);
	static void SetColsRowsInAllSeries(int, int);	
	static void SetColsRowsInAllStudies(int, int);
	static void SetWLInAllStudies(int, int);
	static void flushAllPanelsStates();
	static void setChooseMode();
	static void setWindowLevelMode();
	static void setMoveMode();
	static void hideShowOverlayMode();
	static void hideShowOverlayModeMPR();

	static void setDeleteMarksMode();
	static void hideShowMarks();
	static void setDrawSizeDistMode();	
	static void setScaleSizeDistMode();
	static void setDrawTextH();
	static void setDrawAngle();
	static void setDrawCurve();
	static void setDrawSpot();
	static void setMPRPlaneMode();
	static void do2MPRPlanes();
	static void SetAutoFillTopPanels();
	static void setFirstTopPanel( QString );
	static void erasingShift();
	static void updateAllMainWindows();
	static void SetChosenAllInActive(BOOLEAN, int type = 0);
	void SetColsRows(int cols, int rows);
	void SetColsRowsInSeries(int cols, int rows);		
	void SetCols(int);
	void SetRows(int);	
	int cols;
	int rows;
	void addDicomStructs();
	void addDicomStructsWithUpdateSeries();
	void addDicomStructsWithAddNewSeries();
	void sortBySeries();
	void sortBySeriesWithClearing();
	void reSizeChildren();	
	static void TryFillEmpty();	
	ContainerPanel(void);	
	HWND OneViewWindow;
	Panel * saveFirst;
	Panel * saveLast;
	Panel * saveParent;
	Panel * saveNext;
	ImagePanel * viewedPanel;
	ImagePanel * currentViewedPanel;
	int saveRows;
	int saveCols;
	void rePlaceALLDicomStructs(DICOMStruct *);			
	RECT getRectOfChildWindowByNumber(int, RECT);
	void on_wm_paint(HWND , UINT , WPARAM , LPARAM);
	void on_wm_create(HWND, UINT , WPARAM , LPARAM);
	void on_wm_lrbuttondown(HWND , UINT , WPARAM , LPARAM);
	void on_wm_lrbuttonup(HWND , UINT , WPARAM , LPARAM);
	void on_wm_mousemove(HWND , UINT , WPARAM , LPARAM);	
	HDC getMyDC();
public:
	~ContainerPanel(void);
	static void SetColsRowsInSeriesPrint(int cols, int rows);
	float getMaxRatio();
	static int getMaxNumberImgInSeries();
	virtual void repaintInformationPanel();	
	static void setMoveMPRMode();
	static void hideShowRefLine();
	static void hideShowRefLineAll();
};

